package com.blog1.pojo.response;

import com.blog1.enums.ResultCodeEnum;
import lombok.Data;

@Data
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    public static Result success(Object data){
        Result result=new Result();
        result.setCode(ResultCodeEnum.SUCCESS.getCode());
        result.setMsg(ResultCodeEnum.SUCCESS.getMsg());
        result.setData(data);
        return result;
    }

    public static Result error(){
        Result result=new Result();
        result.setCode(ResultCodeEnum.ERROR.getCode());
        result.setMsg(ResultCodeEnum.ERROR.getMsg());
        return result;
    }

    public static Result error(Object data){
        Result result=new Result();
        result.setCode(ResultCodeEnum.ERROR.getCode());
        result.setMsg(ResultCodeEnum.ERROR.getMsg());
        return result;
    }


}
